package org.wattdepot.gdata.kukuicup.service;

import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.wattdepot.gdata.kukuicup.GDataProperties;

/**
 * Tests the GDataBatchRequest class.
 * @author Philip Johnson
 */
public class TestGDataBatchRequest  {
  /** Sample spreadsheet name. */
  private String spreadsheetName = "KukuiCupData";
  
  /**
   * Tests that we can create 10 requests and send them successfully.
   * @throws Exception If problems occur. 
   */
  @Test
  public void testGDataBatchRequest() throws Exception {
    GDataProperties properties = new GDataProperties();
    GDataService service = new GDataService(properties);
    GDataBatchRequest request = new GDataBatchRequest(service, 
        service.getSpreadsheetURL(spreadsheetName));
    int row = 100;
    request.addRequest(row, 1, "Testing Row!");
    for (int column = 2; column < 10; column++) {
      request.addRequest(row, column, String.valueOf(column));
    }
    boolean success = request.sendRequest();
    assertTrue("Testing GDataBatchRequest", success);
  }
}
